/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.stone.common.util;

import java.io.IOException;
import java.util.Date;
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;

/**
 *
 * @author apple
 */
public class SimpleDateSerializer extends JsonSerializer<Date> {

    @Override
    public void serialize(Date t, JsonGenerator jg, SerializerProvider sp) throws IOException, JsonProcessingException {
        String formattedDate = DateUtil.dateFormatStr(DateUtil.DATE_FORMAT, t);
        jg.writeString(formattedDate); 
    }
    
}
